<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Pages extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -  
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in 
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
	
    function __construct()
    {
        parent::__construct();
    	$this->load->library('session');
    	//$this->load->database();
    	//$this->load->model("modlogin");
    	$this->load->helper('url');
    	$this->load->helper('language');
    	$this->load->helper('imagemerge');
    	
    	
	}
	
			
	public function loginadmin()
	{
		$this->load->view("login");
	}
	
	
	function qrcode()
	{
		$this->load->library('ciqrcode');
		header("Content-Type: image/png");
		$params['data'] = 'This is a text to encode become QR Code';
		$this->ciqrcode->generate($params);
	}
	function writeqrcode($content)
	{
		$this->load->library('ciqrcode');
		$params['data'] = $content;
		$params['level'] = 'H';
		$params['size'] = 2;
		$params['savename'] = "./images/".'tes.png';
		$this->ciqrcode->generate($params);
		
		//echo '<img src="'.base_url().'tes.png" />';
				
	}
		
	
	function testlink()
	{
		
		$this->lang->load('pages');
		$data=array("lang"=>$this->config->item('language'));
		$this->load->view('langtest',$data);
	}
	
		function testlink2()
	{
		
		$this->lang->load('pages',$this->config->item('post_lang'));
		$data=array("lang"=>$this->config->item('language'));
		$this->load->view('langtest2',$data);
	}
	
	function createcoupon()
	{
		
		merge('./images/coupon.jpg', './images/tes.png', './images/merged.jpg');
		$this->load->view('coupon');
	}
	
	function pagepromotion()
	{
		$this->load->view('couponform');
	}
	
	function createqrpro()
	{
		$content=$this->input->get_post("email");
		$this->writeqrcode($content);
		$this->createcoupon();
	}
	
}
?>
